package com.quartz.com.template;

public class TemplateMethod {
    public final void print(String message){
        System.out.println("-----");
        wrapPrint(message);
        System.out.println("=====");

    }
    protected void wrapPrint(String message){

    }

    public static void main(String[] args) {
        TemplateMethod t1 =new TemplateMethod(){
            @Override
            protected void wrapPrint(String message){
                System.out.printf("111---"+message+"--111");
            }
        };
        t1.print("hello world");

        TemplateMethod t2 =new TemplateMethod(){
            @Override
            protected void wrapPrint(String message){
                System.out.printf("222---"+message+"--222");
            }
        };
        t2.print("hello myself");
    }
}
